<%namespace file="/base/helper.html" name="helper" \
import="OLOrthographySpecifyingHelp, MLOrthographySpecifyingHelp, ISO_639Help,
objectLanguageNameHelp, storageOrthographyHelp, defaultInputOrthographyHelp,
defaultOutputOrthographyHelp, orthographyNameHelp, OLOrthographyHelp,
metaLanguageNameHelp, headerImageHelp"/>

<%namespace file="/base/javascriptDefs.html" name="javascriptDefs" \
import="getMatchingLanguagesScript, getToggleDivByTextInputScripts"/>

<%inherit file="/base/index.html" />


<% 
    sUrl = url(controller='settings', action='getmatchinglanguages') 
%>

<%def name="writeJavascriptToHead()">
    ${getMatchingLanguagesScript()}
    ${getToggleDivByTextInputScripts()}
</%def>
 
<%def name="heading()">
    <h1 class="heading">Editing Application Settings</h1>
</%def>

<p>This page permits editing of system-wide application settings. \
Only administrators should alter these settings.</p>

<form class="formTable" \
      action="${url(controller='settings', action='save')}" method="post">
    <fieldset>
    <legend>Object Language</legend>
    <ol>
     <li>
      <p>Name ${objectLanguageNameHelp()}</p>
      <input id="OLName" maxlength="255" style="width:500px;" name="OLName" \
             tabindex="1" type="text" \
             onkeyup="getMatchingLanguages('${sUrl}', 'OLName', 'Ref_Name');" \
             onfocus="divOn('OLNameSuggestion'); applyFuncToAll(divOff, \
             ['OLIdSuggestion', 'MLNameSuggestion', 'MLIdSuggestion']);" />
      <div class="suggestion" id="OLNameSuggestion"></div>
     </li>
     <li>
      <p>ISO 639-3 Code ${ISO_639Help()}</p>
      <input id="OLId" maxlength="255" style="width:500px;" name="OLId" \
             tabindex="2" type="text" \
             onkeyup="getMatchingLanguages('${sUrl}', 'OLId', 'Id');" \
             onfocus="divOn('OLIdSuggestion'); applyFuncToAll(divOff, \
             ['OLNameSuggestion', 'MLNameSuggestion', 'MLIdSuggestion']);" />
      <div class="suggestion" id="OLIdSuggestion"></div>
     </li>
    </ol>
    </fieldset>
    
    <fieldset>
    <legend>
        Object Language Orthographies
    </legend>
    
    <input type='hidden' id='OLOrthographiesWarning' \
           name='OLOrthographiesWarning' />
    
    <ol>
     <li>
      <p>Here you can specify up to five orthographies for your object language.\
      Specifying multiple object language orthographies allows the option of \
      storing, viewing and entering object language data in different \
      orthographies.</p> \
      \
      <p>Choose one object language orthography as the storage orthography. \
      All object language strings in the database will be stored in this \
      orthography.  Choose a storage orthography when the application \
      is initially set up and do not alter it afterwards.</p> \
      \
      <p>Choose an object language orthography as the default input \
      orthography. By default, this is the orthography that users will use \
      when entering and searching for object language data.  When entering \
      object language data (or searching it), the system will automatically \
      translate the input into the storage orthography.</p> \
      \
      <p>Choose an object language orthography as the default output \
      orthography.  By default, this is the orthography that will be used to \
      display object language data.</p> \
      \
      <p>If you want the default to be that users enter, view and search object \
      language data all in the same orthography (recommended), then simply \
      choose the same orthography as your storage, default input and default \
      output orthographies.</p>
    
      <a class="buttonLink" id="addRemoveOLO" tabindex=4 \
      onclick="addRemoveElement('OLOrthographies','addRemoveOLO',\
      'object language orthographies settings')">+</a>
     </li>
    </ol>
    
    <div id="OLOrthographies" style="display:none;">
      <%
        OLOOptions = ['Object Language Orthography %s' % str(i) for i in \
                     range(1,6)]
      %>
    <ol>
        
     <li>
      <p>Storage Orthography</p>
      ${h.select(name='storageOrthography', selected_values='',\
      options=OLOOptions, tabindex=4)}
     </li>
     
     <li>
      <p>Default Input Orthography</p>
      ${h.select(name='defaultInputOrthography', selected_values='',\
      options=OLOOptions , tabindex=4)}
     </li>
     
     <li>
      <p>Default Output Orthography</p>
      ${h.select(name='defaultOutputOrthography', selected_values='',\
      options=OLOOptions , tabindex=4)}
     </li>

    </ol>
    
    <fieldset class="innerFieldset">
    <ol>
     <legend>
        Oblect Language Orthography 1
     </legend>
     <li>
      <p>Name ${orthographyNameHelp()}</p>
      <input id="objectLanguageOrthography1Name" maxlength="255" \
             style="width:500px;" name="objectLanguageOrthography1Name" \
             tabindex="4" type="text" />
     </li>
     <li>
      <p>Orthography ${OLOrthographyHelp()}</p>
      <textarea id="objectLanguageOrthography1" \
                name="objectLanguageOrthography1" rows="5" \
                cols="80" tabindex="5"></textarea>
     </li>
     <li>
      <p>Optional Parameters</p>
        <p>
         <input id='OLO1Lowercase' name='OLO1Lowercase' type="checkbox" \
                value='1' />
         Only lowercase graphs are used in this orthography. Default is true. \
         (If this checkbox is deselected, the OLD will try to guess uppercase \
         alternants of the graphs in this orthography.)
        </p>
        <p>
         <input id='OLO1InitialGlottalStops' name='OLO1InitialGlottalStops' \
                type="checkbox" value='1' />
         Glottal stops are written at the beginning of a word. Default is true. \
         (If this checkbox is deselected, the OLD will remove initial glottal \
         stops when translating strings into this orthography.)
        </p>
     </li>
    </ol>
    </fieldset>
    
    <fieldset class="innerFieldset">
    <ol>
     <legend>
        Oblect Language Orthography 2
     </legend>
     <li>
      <p>Name ${orthographyNameHelp()}</p>
      <input id="objectLanguageOrthography2Name" maxlength="255" \
             style="width:500px;" name="objectLanguageOrthography2Name" \
             tabindex="6" type="text" />
     </li>
     <li>
      <p>Orthography ${OLOrthographyHelp()}</p>
      <textarea id="objectLanguageOrthography2" \
                name="objectLanguageOrthography2" rows="5" \
                cols="80" tabindex="7"></textarea>
     </li>
     <li>
      <p>Optional Parameters</p>
        <p>
         <input id='OLO2Lowercase' name='OLO2Lowercase' type="checkbox" \
                value='1' />
         Only lowercase graphs are used in this orthography. Default is true. \
         (If this checkbox is deselected, the OLD will try to guess uppercase \
         alternants of the graphs in this orthography.)
        </p>
        <p>
         <input id='OLO2InitialGlottalStops' name='OLO2InitialGlottalStops' \
                type="checkbox" value='1' />
         Glottal stops are written at the beginning of a word. Default is true. \
         (If this checkbox is deselected, the OLD will remove initial glottal \
         stops when translating strings into this orthography.)
        </p>
     </li>
    </ol>
    </fieldset>
     
    <fieldset class="innerFieldset">
    <ol>
     <legend>
        Oblect Language Orthography 3
     </legend>
     <li>
      <p>Name ${orthographyNameHelp()}</p>
      <input id="objectLanguageOrthography3Name" maxlength="255" \
             style="width:500px;" name="objectLanguageOrthography3Name" \
             tabindex="8" type="text" />
     </li>
     <li>
      <p>Orthography ${OLOrthographyHelp()}</p>
      <textarea id="objectLanguageOrthography3" \
                name="objectLanguageOrthography3" rows="5" \
                cols="80" tabindex="9"></textarea>
     </li>
     <li>
      <p>Optional Parameters</p>
        <p>
         <input id='OLO3Lowercase' name='OLO3Lowercase' type="checkbox"\
                value='1' />
         Only lowercase graphs are used in this orthography. Default is true. \
         (If this checkbox is deselected, the OLD will try to guess uppercase \
         alternants of the graphs in this orthography.)
        </p>
        <p>
         <input id='OLO3InitialGlottalStops' name='OLO3InitialGlottalStops' \
                type="checkbox" value='1' />
         Glottal stops are written at the beginning of a word. Default is true. \
         (If this checkbox is deselected, the OLD will remove initial glottal \
         stops when translating strings into this orthography.)
        </p>
     </li>
    </ol>
    </fieldset>
     
    <fieldset class="innerFieldset">
    <ol>
     <legend>
        Oblect Language Orthography 4
     </legend>
     <li>
      <p>Name ${orthographyNameHelp()}</p>
      <input id="objectLanguageOrthography4Name" maxlength="255" \
             style="width:500px;" name="objectLanguageOrthography4Name" \
             tabindex="10" type="text" />
     </li>
     <li>
      <p>Orthography ${OLOrthographyHelp()}</p>
      <textarea id="objectLanguageOrthography4" \
                name="objectLanguageOrthography4" rows="5" \
                cols="80" tabindex="11"></textarea>
     </li>
     <li>
      <p>Optional Parameters</p>
        <p>
         <input id='OLO4Lowercase' name='OLO4Lowercase' type="checkbox" \
                value='1' />
         Only lowercase graphs are used in this orthography. Default is true. \
         (If this checkbox is deselected, the OLD will try to guess uppercase \
         alternants of the graphs in this orthography.)
        </p>
        <p>
         <input id='OLO4InitialGlottalStops' name='OLO4InitialGlottalStops' \
                type="checkbox" value='1' />
         Glottal stops are written at the beginning of a word. Default is true. \
         (If this checkbox is deselected, the OLD will remove initial glottal \
         stops when translating strings into this orthography.)
        </p>
     </li>
    </ol>
    </fieldset>

    <fieldset class="innerFieldset">
    <ol>
     <legend>
        Oblect Language Orthography 5
     </legend>
     <li>
      <p>Name ${orthographyNameHelp()}</p>
      <input id="objectLanguageOrthography5Name" maxlength="255" \
             style="width:500px;" name="objectLanguageOrthography5Name" \
             tabindex="12" type="text" />
     </li>
     <li>
      <p>Orthography ${OLOrthographyHelp()}</p>
      <textarea id="objectLanguageOrthography5" \
                name="objectLanguageOrthography5" rows="5" \
                cols="80" tabindex="13"></textarea>
     </li>
     <li>
      <p>Optional Parameters</p>
        <p>
         <input id='OLO5Lowercase' name='OLO5Lowercase' type="checkbox" \
                value='1' />
         Only lowercase graphs are used in this orthography. Default is true. \
         (If this checkbox is deselected, the OLD will try to guess uppercase \
         alternants of the graphs in this orthography.)
        </p>
        <p>
         <input id='OLO5InitialGlottalStops' name='OLO5InitialGlottalStops' \
                type="checkbox" value='1' />
         Glottal stops are written at the beginning of a word. Default is true. \
         (If this checkbox is deselected, the OLD will remove initial glottal \
         stops when translating strings into this orthography.)
        </p>
     </li>
    </ol>
    </fieldset>

    </div>
    </fieldset>


    <fieldset>
    <legend>Object Language Strings</legend>
    <ol>
     <li>
      <p>The system should assume that the morpheme break data of a Form is
      an object language string and should therefore be converted to the
      storage orthography for storage and to the output orthography for display.
      </p>
      ${h.select(name='morphemeBreakIsObjectLanguageString', selected_values='', \
                      options=[u'yes', u'no'], tabindex=13)}
     </li>
    </ol>
    </fieldset>


    <fieldset>
    <legend>Metalanguage</legend>
    <ol>
     <li>
      <p>Name ${metaLanguageNameHelp()}</p>
      <input id="MLName" maxlength="255" style="width:500px;" name="MLName" \
             tabindex="14" type="text" \
             onkeyup="getMatchingLanguages('${sUrl}', 'MLName', 'Ref_Name');" \
             onfocus="divOn('MLNameSuggestion'); applyFuncToAll(divOff, \
             ['OLIdSuggestion', 'OLNameSuggestion', 'MLIdSuggestion']);" />
      <div class="suggestion" id="MLNameSuggestion"></div>
     </li>
     <li>
      <p>ISO 639-3 code ${ISO_639Help()}</p>
      <input id="MLId" maxlength="255" style="width:500px;" name="MLId" \
             tabindex="15" type="text" \
             onkeyup="getMatchingLanguages('${sUrl}', 'MLId', 'Id');" \
             onfocus="divOn('MLIdSuggestion'); applyFuncToAll(divOff, \
             ['OLIdSuggestion', 'OLNameSuggestion', 'MLNameSuggestion']);" />
      <div class="suggestion" id="MLIdSuggestion"></div>
     </li>   
     <li>
      <p>Orthography - characters used to transcribe the metalanguage. \
      ${MLOrthographySpecifyingHelp()}</p>
      <textarea id="MLOrthography" name="MLOrthography" rows="5" cols="80" \
                tabindex="16"></textarea>
     </li>       
    </ol>
    </fieldset>
    
    <fieldset>
    <legend>Appearance</legend>
    <ol>
     <li>
      <p>Header image - name of an image File for the header background \
      ${headerImageHelp()}</p>
      <input id="headerImageName" name="headerImageName" tabindex="17" />
     </li>
     <li>
      <p>CSS colors - name of a CSS file for the color scheme</p>
      ${h.select(name='colorsCSS', selected_values='',\
      options=c.colorsCSSOptions, tabindex=16)}
     </li>
    </ol>
    </fieldset>
    
    <div>${h.submit(value="Save Changes", name='submit', tabindex=30)}</div>
</form>

 